// ==========================================================================
// 云捷GO自动生成数据库操作代码，无需手动修改，重新生成会自动覆盖.
// 生成日期：2021-08-01 08:34:56
// 生成路径: app/model/module/project/project_entity.go
// 生成人：gfcms
// ==========================================================================

package project

import (
	"database/sql"
	"github.com/gogf/gf/database/gdb"
	"github.com/gogf/gf/os/gtime"
)

// Entity is the golang structure for table t_project.
type Entity struct {
	Id         int64       `orm:"id,primary" json:"id"`           //
	Name       string      `orm:"name" json:"name"`               // 项目名称
	Number     string      `orm:"number" json:"number"`           // 合同编号
	Type       string      `orm:"type" json:"type"`               // 项目类型
	Manager    string      `orm:"manager" json:"manager"`         // 商务
	Customer   string      `orm:"customer" json:"customer"`       // 客户
	Email      string      `orm:"email" json:"email"`             // 邮箱
	Telephone  string      `orm:"telephone" json:"telephone"`     // 电话
	Ordertime  *gtime.Time `orm:"ordertime" json:"ordertime"`     // 接单时间
	Overtime   *gtime.Time `orm:"overtime" json:"overtime"`       // 完结时间
	CreateTime *gtime.Time `orm:"create_time" json:"create_time"` //
	UpdateTime *gtime.Time `orm:"update_time" json:"update_time"` //
}

// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
// the data and where attributes for empty values.
func (r *Entity) OmitEmpty() *arModel {
	return Model.Data(r).OmitEmpty()
}

// Inserts does "INSERT...INTO..." statement for inserting current object into table.
func (r *Entity) Insert() (result sql.Result, err error) {
	return Model.Data(r).Insert()
}

// Replace does "REPLACE...INTO..." statement for inserting current object into table.
// If there's already another same record in the table (it checks using primary key or unique index),
// it deletes it and insert this one.
func (r *Entity) Replace() (result sql.Result, err error) {
	return Model.Data(r).Replace()
}

// Save does "INSERT...INTO..." statement for inserting/updating current object into table.
// It updates the record if there's already another same record in the table
// (it checks using primary key or unique index).
func (r *Entity) Save() (result sql.Result, err error) {
	return Model.Data(r).Save()
}

// Update does "UPDATE...WHERE..." statement for updating current object from table.
// It updates the record if there's already another same record in the table
// (it checks using primary key or unique index).
func (r *Entity) Update() (result sql.Result, err error) {
	return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
}

// Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
func (r *Entity) Delete() (result sql.Result, err error) {
	return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
}
